<?php 
require("phpmailer/class.phpmailer.php");
include_once "constants.inc.php";

class MailBase {
	private $_mail;
	public function __construct() {
	$this->_mail = new PHPMailer(); 
	$this->_mail->IsSMTP(); // send via SMTP
	$this->_mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
	$this->_mail->Host = 'server75.web-hosting.com'; // "ssl://smtp.gmail.com" didn't worked
	$this->_mail->Port = 465;
	$this->_mail->SMTPAuth = true; // turn on SMTP authentication
	$this->_mail->Username = GUSER; // SMTP username
	$this->_mail->Password = GPWD; // SMTP password
	}
	
	public function sendMail($email, $from, $username, $subject, $body) {
		$webmaster_email = $from; //Reply to this email ID
		$this->_mail->From = $webmaster_email;
		$this->_mail->FromName = "Comicblocks";
		$this->_mail->AddAddress($email,$username);
		$this->_mail->AddReplyTo($webmaster_email,"Webmaster");
		$this->_mail->WordWrap = 50; // set word wrap
		$this->_mail->IsHTML(true); // send as HTML
		$this->_mail->Subject = $subject;
		$this->_mail->Body = $body; //HTML Body

		if(!$this->_mail->Send())
		{
		echo "Mailer Error: " . $this->_mail->ErrorInfo;
		}
		else
		{
		echo "Sent";
		}

	}

}
?>